home *** CD-ROM | disk | FTP | other *** search
- ;This function centers any number of text lines
- ;at the midpoint of two vertices (ie opposite corners
- ;of a box) given the text size.
- ;
- ;Function name "EDSCENTX.LSP" - Execution command "CT"
- ;
- ;Written by Steve Brown and Christopher Conrad
- ;
- ;
- (defun c:ct ()
- (setq tsiz (getreal "Enter textsize :"))
- (setq nl (getreal "Number of text lines : "))
- (setq count 1)
- (command "osnap" "int")
- (setq pt1 (getpoint "select 1rst corner"))
- (terpri)
- (setq pt2 (getpoint "select 2nd corner"))
- (terpri)
- (setq pt3x (/ (- (car pt2) (car pt1)) 2))
- (setq pt3y (/ (- (cadr pt2) (cadr pt1)) 2))
- (setq tp (list (+ (car pt1) pt3x) (+ (cadr pt1) pt3y)))
- (setq ofs (/ (1- nl) 2))
- (while (<= count nl)
- (setq tpl (list (car tp) (+ (cadr tp) (* (* tsiz 1.7143)
- ofs))))
- (setq tinp (getstring T "Input text : "))
- (command "text" "m" tpl tsiz "0" tinp)
- (setq ofs (1- ofs))
- (setq count (1+ count))
- (command "osnap" "off")
- )
- )